package com.chinaisafe.user.vo.response;

import com.chinaisafe.user.entity.SysDept;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * SysDeptRespVO
 * Description：部门响应值对象
 *
 * @author xuefu.shu
 * @date  2024-07-12 10:39:32
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@Schema(name = "SysDeptRespVO", description = "部门响应值对象")
public class SysDeptRespVO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "主键id")
    private Long id;

    @Schema(description = "乐观锁版本")
    private Integer version;

    @Schema(description = "部门维度_id")
    private Long sysDeptDimensionId;

    @Schema(description = "部门名称")
    private String name;

    @Schema(description = "部门编码")
    private String code;

    @Schema(description = "上级部门")
    private Long parentId;

    @Schema(description = "排序")
    private Integer seq;

    @Schema(description = "部门负责人")
    private Long managerUserId;

    @Schema(description = "是否启用")
    private Boolean enable;


    /**
     * 将实体类转换为响应值对象
     * @param entity 实体对象
     * @return SysDeptRespVO 响应值对象
     * @author xuefu.shu
     * @date 2024-07-12 10:39:32
     */
    public static SysDeptRespVO convertFromEntity(SysDept entity) {
        SysDeptRespVO respVO = new SysDeptRespVO();
        respVO.id = entity.getId();
        respVO.version = entity.getVersion();
        // 给对应的字段赋值 可根据实际业务删减
        respVO.sysDeptDimensionId = entity.getSysDeptDimensionId();
        respVO.name = entity.getName();
        respVO.code = entity.getCode();
        respVO.parentId = entity.getParentId();
        respVO.seq = entity.getSeq();
        respVO.managerUserId = entity.getManagerUserId();
        respVO.enable = entity.getEnable();
        return respVO;
    }
}
